package com.dollar.ruyuan_juc.promise.promiseMakeTea;

import com.dollar.ruyuan_juc.promise.noPromise.BoilWater;
import com.dollar.ruyuan_juc.promise.noPromise.TeaAndCup;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class Test2 {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        long start = System.currentTimeMillis();
        Future future = Promisor.create(start);
        System.out.println("任务二开始：准备茶叶茶杯，需要3分钟");
        TeaAndCup teaAndCup = new TeaAndCup();
        Thread.sleep(3000);
        teaAndCup.setStatus(true);
        System.out.println("任务二结束：茶叶茶杯结束。");

        BoilWater o = (BoilWater) future.get();
        System.out.println("准备工作结束，开始泡茶，makeTea");
        System.out.println("总共用时：" +
                (System.currentTimeMillis() - start));
    }
}
